<?php include 'includes/pagetop.php';?>
	
<?php include 'includes/navigation.php';?>

<?php include 'includes/tabletopcontainer.php';?>

{message}

<?php if ($action == ''): ?>
	    <div id="content-table-inner">
	    
			<strong><a href="{url}/{page}/create"></>Create New {caption}</a></strong>
			<!--  start table-content  -->
			<div id="table-content">
				<form id="mainform" action="">
				<table border="0" width="100%" cellpadding="0" cellspacing="0" id="product-table">
					<tr>
						<th class="table-header-check"><a id="toggle-all" ></a> </th>
						<th class="table-header-repeat line-left minwidth-1"><a href="">Name</a></th>
						<th class="table-header-repeat line-left minwidth-1"><a href="">Address</a></th>
						<th class="table-header-repeat line-left"><a href="">Description</a></th>
						<th class="table-header-repeat line-left"><a href="">Business Nature</a></th>
						<th class="table-header-options line-left"><a href="">Options</a></th>
					</tr>
					<?php if (isset($tenantlist)): ?>
						{tenantlist}
						<tr class="alternate-row">
							<td><input  type="checkbox"/></td>
							<td>{tenant_name}</td>
							<td>{tenant_address}</td>
							<td>{tenant_description}</td>
							<td>{business_nature_code}</td>
							<td class="options-width">
							<a href="{url}/{page}/edit/{tenant_id}" title="Edit" class="icon-1 info-tooltip"></a>
							<a href="{url}/{page}/delete/{tenant_id}" title="Delete" class="icon-2 info-tooltip"></a>
							</td>
						</tr>
						{/tenantlist}
					<?php endif; ?>
				</table>
				<!--  end product-table................................... --> 
				</form>
			</div>
			<!--  end content-table  -->
		
			<!--  start actions-box ............................................... -- >
			<div id="actions-box">
				<a href="" class="action-slider"></a>
				<div id="actions-box-slider">
					<a href="" class="action-edit">Edit</a>
					<a href="" class="action-delete">Delete</a>
				</div>
				<div class="clear"></div>
			</div>
			<!-- end actions-box........... -->
			
			<div><?= $pagination ?></div>
			
			<!--  start paging..................................................... -- >
			<table border="0" cellpadding="0" cellspacing="0" id="paging-table">
			<tr>
			<td>
				<a href="" class="page-far-left"></a>
				<a href="" class="page-left"></a>
				<div id="page-info">Page <strong>1</strong> / 15</div>
				<a href="" class="page-right"></a>
				<a href="" class="page-far-right"></a>
			</td>
			<td>
			<select  class="styledselect_pages">
				<option value="">Number of rows</option>
				<option value="">1</option>
				<option value="">2</option>
				<option value="">3</option>
			</select>
			</td>
			</tr>
			</table>
			<!--  end paging................ -->
			
			<div class="clear"></div>
		 
		</div>
		<!--  end content-table-inner ............................................END  -->
		</td>	      
	
<?php elseif($action == 'add' || $action == 'edit' ): ?>   

	<form method="post" action="{url}/{page}/<?php echo $action == 'edit' ? 'update' : 'add'; ?>/">
		<input type="hidden" name="id" value="{id}" />
		<!--  start step-holder -->
		<div id="step-holder">
			<div class="step-no">1</div>
			<div class="step-dark-left">Preview</div>
			<div class="step-dark-round">&nbsp;</div>
			<div class="clear"></div>
		</div>
		<!--  end step-holder -->
		
		<!-- start id-form -->
		<table border="0" cellpadding="0" cellspacing="0"  id="id-form">
		
			<tr>
				<th valign="top">Name:</th>
				<td><input type="text" name="name" class="inp-form-error" value="<?=(isset($tenant->name)?$tenant->name:'');?>" /></td>
				<td>
				<div class="error-left"></div>
				<div class="error-inner">This field is required.</div>
				</td>
			</tr>

			<tr>
				<th valign="top">Address:</th>
				<td><textarea rows="" cols="" name="address" class="form-textarea"><?=(isset($tenant->address)?$tenant->address:'');?></textarea></td>
				<td>
				<div class="error-left"></div>
				<div class="error-inner">This field is required.</div>				
				</td>
			</tr>
				
			<tr>
				<th valign="top">Description:</th>
				<td><textarea rows="" cols="" name="description" class="form-textarea"><?=(isset($tenant->description)?$tenant->description:'');?></textarea></td>
				<td></td>
			</tr>
			
			<tr>
				<th valign="top">Business Nature:</th>
				<td>
					<select name="business_nature_id">
						<option value="">-- Select --</option>
						<?php foreach($businessnatures as $bn): ?>
							<option value="<?= $bn->id ?>" <?= (isset($tenant->business_nature_id) ? (($tenant->business_nature_id==$bn->id) ? "SELECTED" : null) : null) ?> ><?= $bn->name ?></option>
						<?php endforeach; ?>						
					</select>
				</td>
				<td>
				<div class="error-left"></div>
				<div class="error-inner">This field is required.</div>				
				</td>
			</tr>
			
			<tr>
				<th>&nbsp;</th>
				<td valign="top">
					<input type="submit" value="" class="form-submit" />
					<input type="reset" value="" class="form-reset"  />
				</td>
				<td></td>
			</tr>
		</table>
	</form>
	<!-- end id-form  -->	  
<?php endif; ?> 

<?php include 'includes/tablebottomcontainer.php';?>